<html>
<head><meta charset="utf-8"><title>cmov in Rust · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cmov.20in.20Rust.html">cmov in Rust</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="172529876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cmov%20in%20Rust/near/172529876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vova <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cmov.20in.20Rust.html#172529876">(Aug 05 2019 at 19:15)</a>:</h4>
<p>Hey I saw this(<a href="https://github.com/xiadz/cmov" target="_blank" title="https://github.com/xiadz/cmov">https://github.com/xiadz/cmov</a>) on my feed and wondered about Rust and then tested it on my pc to confirm</p>
<p>i8700 3.2ghz<br>
#probability;time_branch;time_branch_0;time_branch_1;time_cmov<br>
0.000000;0.882511;0.484089;0.884556;0.338580<br>
0.050000;1.099530;0.879728;1.094407;0.345329<br>
0.100000;1.277492;1.035594;1.281278;0.344896<br>
0.150000;1.506765;0.739541;1.445742;0.346880<br>
0.200000;1.557517;1.604143;1.527989;0.345630<br>
0.250000;1.762647;1.217720;1.491100;0.347277<br>
0.300000;1.650616;1.634871;1.204373;0.348672<br>
0.350000;1.773185;2.592491;2.411367;0.340889<br>
0.400000;2.099715;2.366262;1.649492;0.346297<br>
0.450000;2.197287;2.867265;2.177574;0.345645<br>
0.500000;2.397491;2.726234;2.846761;0.345180<br>
0.550000;2.727086;3.108073;2.590671;0.353667<br>
0.600000;1.909413;2.566348;1.776441;0.342313<br>
0.650000;1.714653;2.332316;1.615921;0.344723<br>
0.700000;1.388782;1.879567;1.890638;0.346914<br>
0.750000;1.536015;2.021682;1.744568;0.343886<br>
0.800000;1.494247;1.983500;1.541455;0.344742<br>
0.850000;1.252894;1.702029;1.304285;0.344089<br>
0.900000;1.070088;1.554968;1.116774;0.343721<br>
0.950000;0.653277;1.294580;0.656864;0.343529<br>
1.000000;0.304066;1.095976;0.303170;0.339022</p>
<p>so looks like on this types of benchmark the use of cmov is preferred on newer processors,  maybe there are benchmarks which produce different results but I'm thinking about improving the average case scenario<br>
I then found this issue <a href="https://github.com/rust-lang/rust/issues/53823" target="_blank" title="https://github.com/rust-lang/rust/issues/53823">https://github.com/rust-lang/rust/issues/53823</a> and looks like disabling x86-cmov-converter is the way to 'force' cmov</p>
<p>Is this some kind of new finding and worth reviving the issue, or I'm just wasting time :D?<br>
should we rewrite this benchmark in Rust to see the results are the same?</p>
<p>EDIT:<br>
after more reading sounds like profile guided optimization should solve this? <a href="https://github.com/rust-lang/rust/pull/61268" target="_blank" title="https://github.com/rust-lang/rust/pull/61268">https://github.com/rust-lang/rust/pull/61268</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>